/*
 * @Author: silence
 * @Date: 2022-05-26 14:29:57
 * @LastEditors: silence silence9685@163.com
 * @LastEditTime: 2023-07-31 15:13:59
 * @Description: 导航————搜索按钮
 */
import 'package:ems_neutral_app/pages/Mine/Language/SilLocalizations/SilLocalizations.dart';
import 'package:flutter/material.dart';

import 'package:sil_base_widget_package/sil_base_widget_package.dart';

import '../../../utils/color/ColorUtils.dart';

class NavSearchBtn extends StatelessWidget {
  final double? width;
  final double? height;
  final String? imgPath;
  final String? hintText;
  final Function(bool, String)? onChange;

  const NavSearchBtn(
      {Key? key,
      this.hintText,
      this.width,
      this.height,
      this.imgPath,
      this.onChange})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SilEmptyButton(
      useConstrained: true,
      backgroundColor: ColorUtils.color_input_bg,
      height: 40.w,
      radius: 6.w,
      padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.w),
      child: Row(
        children: [
          SilImage(
            'imgs/common/searchbar_icon_search@3x.png',
            width: 24.w,
            height: 24.w,
          ),
          Padding(padding: EdgeInsets.only(left: 16.w)),
          Expanded(
              child: SilTextField(
                  hintText: this.hintText ?? LangOf(context)?.sel_country?.search,//'搜索国家',
                  onValid: (valid, value) {
                    if (this.onChange != null) this.onChange!(valid, value);
                  },
                  interface: SilFormattersNickName()))
        ],
      ),
    );
  }
}
